//
//  MenuModel.m
//  EducationAdminClient
//
//  Created by 孙添凤 on 16/9/27.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "MenuModel.h"

@implementation MenuModel
+(JSONKeyMapper*)keyMapper {
    
    /* 注意JuhuiModel里面需要映射2种类型
     1. 驼峰Camel命名规范
     2. 把author.header_img和author_username要映射到JuhuiModel直接字段里面 */
    JSONKeyMapper *mapper = [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
    // 取得影射的blocks对象
    JSONModelKeyMapBlock modelBlock = mapper.modelToJSONKeyBlock;
    
    // 根据上述的重新创建映射条件
    JSONKeyMapper *newMapper = [[JSONKeyMapper alloc] initWithJSONToModelBlock:nil modelToJSONBlock:^NSString *(NSString *keyName) {
        // 告诉我们影射规律
        if ([keyName isEqualToString:@"menuName"]) {
            return @"menuName";
        }else if ([keyName isEqualToString:@"tableId"]) {
            return @"tableId";
        } else if ([keyName isEqualToString:@"parent_menuName"]) {
            return @"parent_menuName";
        }else if ([keyName isEqualToString:@"ifShow"]) {
            return @"ifShow";
        }else if ([keyName isEqualToString:@"pageType"]) {
            return @"pageType";
        }else if ([keyName isEqualToString:@"meunColl"]) {
            return @"meunColl";
        }else if ([keyName isEqualToString:@"menuPageUrl"]) {
            return @"menuPageUrl";
        }else if ([keyName isEqualToString:@"pageId"]) {
            return @"pageId";
        }else if ([keyName isEqualToString:@"actionWay"]) {
            return @"actionWay";
        }
        return modelBlock(keyName);
    }];
    return newMapper;
    
    
    //return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}


+(BOOL)propertyIsOptional:(NSString*)propertyName {
    return  YES;
}


@end
